package server.tool.tool;
import org.springframework.beans.BeanUtils;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
public class BeanUtil {
    public static <T> T convertToBean(Object sourceObject, Class<T> clazz) {
        T result = null;
        if (sourceObject != null) {
            try {
                result = clazz.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
            }
            BeanUtils.copyProperties(sourceObject, result);
        }
        return result;
    }
}
